/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HuyNVK
 */
@Entity
@Table(name = "PRIORITY")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Priority.findAll", query = "SELECT p FROM Priority p"),
    @NamedQuery(name = "Priority.findByPriorityID", query = "SELECT p FROM Priority p WHERE p.priorityID = :priorityID"),
    @NamedQuery(name = "Priority.findByName", query = "SELECT p FROM Priority p WHERE p.name = :name"),
    @NamedQuery(name = "Priority.findByDescription", query = "SELECT p FROM Priority p WHERE p.description = :description")})
public class Priority implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PriorityID")
    private String priorityID;
    @Basic(optional = false)
    @Column(name = "Name")
    private String name;
    @Column(name = "Description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "priorityID")
    private Collection<Defectlog> defectlogCollection;

    public Priority() {
    }

    public Priority(String priorityID) {
        this.priorityID = priorityID;
    }

    public Priority(String priorityID, String name) {
        this.priorityID = priorityID;
        this.name = name;
    }

    public String getPriorityID() {
        return priorityID;
    }

    public void setPriorityID(String priorityID) {
        this.priorityID = priorityID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Defectlog> getDefectlogCollection() {
        return defectlogCollection;
    }

    public void setDefectlogCollection(Collection<Defectlog> defectlogCollection) {
        this.defectlogCollection = defectlogCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (priorityID != null ? priorityID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Priority)) {
            return false;
        }
        Priority other = (Priority) object;
        if ((this.priorityID == null && other.priorityID != null) || (this.priorityID != null && !this.priorityID.equals(other.priorityID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Priority[ priorityID=" + priorityID + " ]";
    }
    
}
